<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //for in 不推荐便利数组
    //let arr = [1, 2, 3, 4, 5]
    //for (let k in arr) {
    //  console.log(k)//数组下标 字符串类型的下标为字符串
    //}
    let obj = {
      uname: "zhangsan",
      age: 18,
      sex: "male"
    }
    for (let k in obj) {
      console.log(k)
      console.log(obj[k])
    }
  </script>
</body>

</html>